<?php

namespace Module\AdminLoginBackground\Admin\Controller;

use Illuminate\Routing\Controller;
use ModStart\Admin\Layout\AdminConfigBuilder;
use ModStart\Form\Form;

class ConfigController extends Controller
{
    public function index(AdminConfigBuilder $builder)
    {
        $builder->pageTitle('管理登录背景');
        $builder->radio('AdminLoginBackground_Type', '背景类型')
            ->options([
                'none' => '默认背景',
                'random' => '随机背景',
                'fixed' => '固定背景'
            ])
            ->defaultValue('none')
            ->when('fixed', function (Form $form) {
                $form->image('AdminLoginBackground_Image', '固定背景图片');
            });
        return $builder->perform();
    }

}
